package com.quanquan.parking.ketop.repository;

import com.quanquan.parking.ketop.entity.UserDisCount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

/**
 * @ClassName:UserDisCountRepository
 * @Description:TODO
 * @Author:xiongjunbao
 * @Date:2019/12/30 10:20
 * @Version 1.0
 */
public interface UserDisCountRepository extends JpaRepository<UserDisCount,String>{

    /**
     * 查询生效的会员停车优惠
     *
     * @return
     */
    @Query(value = "select * from oo_user_discount where status = 0 and start_time <= ?1 and end_time > ?1",nativeQuery = true)
    UserDisCount findUserDisCountByStatus(String dateTime);


    /**
     * 查询会员停车优惠(后台)
     *
     * @return
     */
    @Query(value = "select * from oo_user_discount",nativeQuery = true)
    UserDisCount findUserDisCountBack();

}
